<html>
<head><meta charset="utf-8"><title>specialization RFC · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/specialization.20RFC.html">specialization RFC</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="164843190"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/specialization%20RFC/near/164843190" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Sunjay Varma <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/specialization.20RFC.html#164843190">(May 04 2019 at 01:23)</a>:</h4>
<p>Hi, I'm reading the <a href="https://rust-lang.github.io/rfcs/1210-impl-specialization.html" target="_blank" title="https://rust-lang.github.io/rfcs/1210-impl-specialization.html">specialization RFC</a> and I'm wondering if anyone could explain this paragraph:</p>
<blockquote>
<p>One nice thing about this approach is that, if there is an overlap without there being an intersecting impl, the compiler can tell the programmer precisely which impl needs to be written to disambiguate the overlapping portion.</p>
</blockquote>



<a name="164843234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/specialization%20RFC/near/164843234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Sunjay Varma <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/specialization.20RFC.html#164843234">(May 04 2019 at 01:25)</a>:</h4>
<p>I'm not sure what case this is referring to. I don't see how the compiler would <em>generally</em> be able to decide which impl needs to be written. Would it just take whatever the intersecting impl should be? I think I might be misunderstanding what this paragraph is trying to say</p>



<a name="165550995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/specialization%20RFC/near/165550995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/specialization.20RFC.html#165550995">(May 13 2019 at 17:44)</a>:</h4>
<p><span class="user-mention" data-user-id="117350">@Sunjay Varma</span> </p>
<p>Imagine</p>
<div class="codehilite"><pre><span></span><span class="k">impl</span><span class="o">&lt;</span><span class="n">T</span>: <span class="nb">Clone</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">T</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="k">impl</span><span class="o">&lt;</span><span class="n">T</span>: <span class="nb">Send</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">T</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</pre></div>


<p>here the compiler could suggest adding the following</p>
<div class="codehilite"><pre><span></span><span class="k">impl</span><span class="o">&lt;</span><span class="n">T</span>: <span class="nb">Clone</span> <span class="o">+</span><span class="w"> </span><span class="nb">Send</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">T</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</pre></div>



<a name="165551004"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/specialization%20RFC/near/165551004" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/specialization.20RFC.html#165551004">(May 13 2019 at 17:44)</a>:</h4>
<p>this is what the text is referring to, anyway</p>



<a name="165551936"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/specialization%20RFC/near/165551936" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Sunjay Varma <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/specialization.20RFC.html#165551936">(May 13 2019 at 17:56)</a>:</h4>
<p>Thanks! I thought this message got lost in all the activity <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>